Hyperbolic Solvers

In this example, we will solve the 1D advection equation

$$\frac{\partial u}{\partial t} + a \frac{\partial u}{\partial x} = 0,$$ where $a = 1$ is a constant.

using the initial condition

$$u(x,0) = \begin{cases} \sin^4 2\pi x & 0 \le x \le \frac12 \\ 1 & \frac46 \le x \le \frac56 \\ 0 & \text{otherwise} \end{cases}$$

We also use periodic boundary conditions $u(0,t) = u(1,t)$ for all $t \ge 0$. This allows us to understand how each solver affects the solution in terms of smoothing and phase shift.

Below, we compare four different hyperbolic solvers:

First Order Upwind

Lax-Friedrichs

Lax-Wendroff

MacCormack